<template>
	<view class="grid-item" @click.stop="handleToClick">
		<text>{{ itemData }}</text>
	</view>
</template>
<script setup>
const props = defineProps({
	itemData: {
		type: String,
		default: () => {
			return ''
		}
	},
	itemIndex: {
		type: [Object, Number],
		default: () => {
			return -1
		}
	}
})
const emits = defineEmits(['itemClickIndex', 'itemClick'])

const handleToClick = () => {
	emits('itemClick', props.itemData)
	emits('itemClickIndex', props.itemIndex)
}
</script>
<style lang="scss" scoped>
.grid-item {
	height: 74rpx;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	padding: 0 32rpx;
	background: #F6F6F6;
	border-radius: 10rpx;
	margin-right: 16rpx;
	margin-top: 12rpx;

	text {
		font-size: 26rpx;
		color: #1D161F;
	}

	&:active {
		opacity: 0.7;
	}
}
</style>